package com.ff.discounts.component.order

import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.ff.discounts.databinding.FragmentOrderBinding
import com.ff.discounts.fragment.BaseViewModelFragment
import com.ff.discounts.util.Constant
import com.ff.discounts.util.DataUtil

/**
 * 商品订单
 * @author: fufang
 * @date: 2023/11/2
 */
class OrderFragment : BaseViewModelFragment<FragmentOrderBinding>() {
    private lateinit var adapter: OrderAdapter

    override fun initViews() {
        super.initViews()
        binding.list.apply {
            layoutManager = LinearLayoutManager(hostActivity)
        }
    }


    override fun initDatum() {
        super.initDatum()
        adapter = OrderAdapter()
        binding.list.adapter = adapter
        adapter.submitList(DataUtil.historyDataList)
    }

    companion object{
        fun newInstance(status:Int):OrderFragment{
            val args = Bundle()
            args.putInt(Constant.STYLE,status)
            val fragment = OrderFragment()
            fragment.arguments = args
            return fragment
        }
    }
}